@JoeKun,
I should have provided these details when asking the question. Sorry about that.
I am using iOS 15 beta 3. Here's the code I am using to fetch library playlists:
var playlists: [Playlist]
struct MyPlaylistsResponse: Decodable {
let data: [Playlist]
}
let url = URL(string: "https://api.music.apple.com/v1/me/library/playlists")!
let dataRequest = MusicDataRequest(urlRequest: URLRequest(url: url))
do {
let dataResponse = try await dataRequest.response()
let decoder = JSONDecoder()
let playlistsResponse = try decoder.decode(MyPlaylistsResponse.self, from: dataResponse.data)
playlists = playlistsResponse.data
} catch let error {
print("** Error **")
print(error)
}
and then I am trying to get the curator name like this:
for playlist in playlists {
print(playlist.curatorName)
}
playlist.curatorName returns nil for all playlists in array.
Topic:
Programming Languages
SubTopic:
Swift
Tags: